home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / wb-enhancement / bangermenu / bangermenudisk.asm < prev    next >
Assembly Source File  |  1996-02-13  |  16KB  |  737 lines

  1. ;Programm: BangerMenuDisk bietet eine grafische Oberfläche zum Anwählen von Programmen
  2. ;          die beim Starten in der Startup-Sequence aufgerufen werden sollen.
  3. ;Autor   : Andre´ Trettin
  4. ;Codename: Banger
  5. ;Begin   : 31-Mai-95 17:08:28
  6. ;$VER    : BangerMenuDisk.Asm 1.4 (13-Feb-96)
  7.  
  8. ** INCLUDE Struktur Variablen
  9. * Fehler Codes: 21=kein Speicher
  10. *               22=konnte Library (oder Libraries) nicht öffnen
  11. *               23=GetVisualInfo Fehler
  12. *               24=konnte File S:Banger.Prefs nicht öffnen
  13. *               25=bei der Gadgeterschaffung trat ein Fehler auf
  14. *               26=konnte Fenster nicht öffnen oder Task nicht Finden
  15. *               27=Einstellungen sind Leer
  16. *               28=kein Speicher für die Einstellungen
  17. *               29=kein MsgPort
  18. *               30=konnte kein IORequest create
  19. *               31=konnte Device nicht öffnen
  20. *               32=falsche Parameter angabe
  21. *               10=Return Code für die Startup-Sequence
  22.  
  23.     incdir  INCLUDE:
  24.     include exec/exec.i
  25.     include exec/io.i
  26.     include devices/input.i
  27.     include devices/inputevent.i
  28.     include dos/dos.i
  29.     include dos/dosextens.i
  30.     include intuition/intuition.i
  31.     include libraries/gadtools.i
  32.     include lvo/exec_lib.i
  33.     include lvo/dos_lib.i
  34.     include lvo/intuition_lib.i
  35.     include lvo/gadtools_lib.i
  36.     include lvo/input_lib.i
  37.  
  38.     STRUCTURE Internal,0
  39.     APTR    INTUIBase
  40.     APTR    DOSBase
  41.     APTR    GADBase
  42.     APTR    WindowHandle
  43.     APTR    OutputHandle
  44.     APTR    ScreenHandle
  45.     APTR    VisualInfo
  46.     APTR    PrefsFileHandle
  47.     APTR    FileSpeicher
  48.     APTR    FontAddr
  49.     APTR    GadgetListe
  50.     APTR    meinTask
  51.     APTR    alterTask
  52.     APTR    AnGad
  53.     APTR    MsgPortAddr
  54.     APTR    RDArgs
  55.     STRUCT  FIB,[fib_SIZEOF]
  56.     STRUCT  GadgetAddr,[68*4]
  57.     STRUCT  TastenIBlock,[IO_SIZE]
  58.     LONG    Filegroesse
  59.     LONG    NOKEYArray
  60.     WORD    BreiteGPos
  61.     WORD    BreiteGADs
  62.     WORD    BreiteWin
  63.     WORD    CAPS
  64.     BYTE    AnzahlGADs
  65.     BYTE    RelativeTopC
  66.     BYTE    RelativeLeftC
  67.     LABEL   Int_SIZEOF
  68. ;;
  69. ** Hauptprog
  70.     moveq   #0,d7
  71.     move.l  4.w,a6
  72.     move.l  #Int_SIZEOF,d0
  73.     move.l  #MEMF_PUBLIC!MEMF_CLEAR,d1
  74.     jsr     _LVOAllocMem(a6)
  75.     move.l  d0,a5
  76.     bne.s   LibraryO
  77.     moveq   #21,d7           ;21 = kein Speicher
  78.     bra.s   Ende
  79. LibraryO
  80.     bsr.w   InitRelative
  81.     bsr.w   LibOeffne
  82.     tst.w   d7
  83.     bne.s   SchliesseLibrary
  84.     bsr.s   Parameter
  85.     tst.w   d7
  86.     bne.s   SchliesseLibrary
  87.     bsr.w   WaitOnCaps
  88.     cmp.w   #10,d7
  89.     bhi.s   SchliesseLibrary
  90.     tst.w   d7
  91.     beq.s   Menuerscheine
  92.     moveq   #0,d7
  93.     bra.s   SchliesseLibrary
  94. Menuerscheine
  95.     bsr.w   PubScreenOeffne
  96.     tst.w   d7
  97.     bne.s   SchliesseLibrary
  98.     bsr.w   LadePrefs
  99.     tst.w   d7
  100.     bne.s   SchliesseScreen
  101.     bsr.w   InitGadget
  102.     tst.w   d7
  103.     bne.s   FreiSPrefs
  104.     bsr.w   FensterOeffne
  105.     tst.w   d7
  106.     bne.s   RemGad
  107.     bsr.w   GadAktivieren
  108.     bsr.w   RefreshWin
  109.     bsr.w   MessageAbFragen
  110.     bsr.w   FensterSchliesse
  111. RemGad
  112.     bsr.w   RemoveGadget
  113. FreiSPrefs
  114.     bsr.w   SpeicherPrefs
  115. SchliesseScreen
  116.     bsr.w   ScreenSchliesse
  117. SchliesseLibrary
  118.     bsr.w   LibSchliesse
  119.     move.l  a5,a1
  120.     move.l  #Int_SIZEOF,d0
  121.     jsr     _LVOFreeMem(a6)
  122. Ende
  123.     move.l  d7,d0
  124. ende
  125.     rts
  126. ;;
  127. ** Parameter
  128. Parameter
  129.     move.l  DOSBase(a5),a6
  130.     lea     ParaTemplate(pc),a1
  131.     move.l  a1,d1
  132.     lea     NOKEYArray(a5),a1
  133.     move.l  a1,d2
  134.     moveq   #0,d3
  135.     jsr     _LVOReadArgs(a6)
  136.     move.l  d0,RDArgs(a5)
  137.     bne.s   ParaOK
  138.     jsr     _LVOIoErr(a6)
  139.     move.l  d0,d1
  140.     moveq   #0,d2
  141.     jsr     _LVOPrintFault(a6)
  142.     moveq   #32,d7
  143.     rts
  144. ParaOK
  145.     move.l  RDArgs(a5),d1
  146.     jsr     _LVOFreeArgs(a6)
  147.     rts
  148. ;;
  149. ** Warte auf Caps Lock
  150. WaitOnCaps
  151.     tst.l   NOKEYArray(a5)
  152.     bne.s   NOKeyJA
  153.     move.l  4.w,a6
  154.     jsr     _LVOCreateMsgPort(a6)
  155.     move.l  d0,MsgPortAddr(a5)
  156.     bne.s   MsgPortOK
  157.     moveq   #29,d7                  ;29 = kein MsgPort
  158.     addq    #4,a7
  159.     pea     SchliesseLibrary(pc)
  160.     rts
  161. MsgPortOK
  162.     move.l  d0,a0
  163.     move.l  #IOSTD_SIZE,d0
  164.     jsr     _LVOCreateIORequest(a6)
  165.     move.l  d0,TastenIBlock(a5)
  166.     bne.s   OeffneDev
  167.     moveq   #30,d7                  ;30=konnte kein IORequest create
  168.     bra.s   FreiMsgP
  169. OeffneDev
  170.     lea     inputname(pc),a0
  171.     move.l  d0,a1
  172.     moveq   #0,d0
  173.     move.l  #IOF_QUICK,d1
  174.     jsr     _LVOOpenDevice(a6)
  175.     tst.l   d0
  176.     beq.s   DevOK
  177.     moveq   #31,d7                   ;31=konnte Device nicht öffnen
  178.     bra.s   IOReqDel
  179. DevOK
  180.     move.l  TastenIBlock(a5),a0
  181.     move.l  IO_DEVICE(a0),a6
  182.     jsr     _LVOPeekQualifier(a6)
  183.     and.w   #IEQUALIFIER_CAPSLOCK,d0
  184.     cmp.w   #IEQUALIFIER_CAPSLOCK,d0
  185.     beq.s   CAPSgedrueckt
  186.     moveq   #10,d7
  187. CAPSgedrueckt
  188.     move.l  4.w,a6
  189.     lea     TastenIBlock(a5),a1
  190.     jsr     _LVOCloseDevice(a6)
  191. IOReqDel
  192.     move.l  TastenIBlock(a5),a0
  193.     jsr     _LVODeleteIORequest(a6)
  194. FreiMsgP
  195.     move.l  MsgPortAddr(a5),a0
  196.     jsr     _LVODeleteMsgPort(a6)
  197. NOKeyJA
  198.     rts
  199. ;;
  200. ** GadAktivieren
  201. GadAktivieren
  202.     move.l  GadgetAddr(a5),a4
  203.     moveq   #1,d6
  204.     bsr.w   SelGK
  205.     lea     GadgetAddr(a5),a4
  206.     move.l  a4,AnGad(a5)
  207.     rts
  208. ;;
  209. ** Relative Init
  210. InitRelative
  211.     lea     topazFName8(pc),a0
  212.     lea     topaz8(pc),a1
  213.     move.l  a0,(a1)
  214.     move.l  a1,FontAddr(a5)
  215.     rts
  216. ;;
  217. ** Message Auswertung
  218. MessageAbFragen
  219.     move.l  WindowHandle(a5),a0
  220.     move.l  wd_UserPort(a0),a0
  221.     move.l  4.w,a6
  222.     jsr     _LVOWaitPort(a6)
  223. nocheine
  224.     move.l  GADBase(a5),a6
  225.     move.l  WindowHandle(a5),a0
  226.     move.l  wd_UserPort(a0),a0
  227.     jsr     _LVOGT_GetIMsg(a6)
  228.     move.l  d0,a1
  229.     tst.l   d0
  230.     beq.s   MessageAbFragen
  231.     move.l  im_Class(a1),d4
  232.     move.w  im_Code(a1),d5
  233.     move.l  im_IAddress(a1),a4
  234.     jsr     _LVOGT_ReplyIMsg(a6)
  235.     cmpi.l  #IDCMP_CLOSEWINDOW,d4
  236.     beq.w   ende
  237.     cmpi.l  #IDCMP_REFRESHWINDOW,d4
  238.     beq.s   RefreWin
  239.     cmpi.l  #IDCMP_GADGETUP,d4
  240.     beq.w   GadAuswertung
  241.     cmpi.l  #IDCMP_VANILLAKEY,d4
  242.     beq.w   VTastendruck
  243.     cmpi.l  #IDCMP_RAWKEY,d4
  244.     beq.w   RTastendruck
  245.     bra.s   nocheine
  246. RefreWin
  247.     bsr.w   RefreshWin
  248.     bra.s   nocheine
  249. UpTaste
  250.     move.l  AnGad(a5),a4
  251.     lea     GadgetAddr(a5),a3
  252.     cmp.l   a3,a4
  253.     beq.s   DownTEnde
  254.     lea     -4(a4),a3
  255.     bra.s   GadAnwaehlen
  256. DownTaste
  257.     move.l  AnGad(a5),a4
  258.     lea     4(a4),a3
  259.     cmp.l   #0,(a3)
  260.     beq.s   DownTEnde
  261. GadAnwaehlen
  262.     move.l  (a4),a4
  263.     moveq   #0,d6
  264.     bsr.w   SelGK
  265.     moveq   #1,d6
  266.     move.l  (a3),a4
  267.     bsr.w   SelGK
  268.     move.l  (a3),a3
  269.     bsr.w   GetGAddr
  270. DownTEnde
  271.     bra.w   nocheine
  272. rechteBank
  273.     bsr.s   NummerGad
  274.     add.w   #17,d0
  275.     cmp.b   AnzahlGADs(a5),d0
  276.     bls.s   rechtsOK
  277.     sub.b   AnzahlGADs(a5),d0
  278.     neg.w   d0
  279.     add.w   #17,d0
  280.     bra.s   rechtsweiter
  281. rechtsOK
  282.     moveq   #17,d0
  283. rechtsweiter
  284.     asl.w   #2,d0
  285.     lea     (a4,d0.w),a3            
  286.     bra.s   GadAnwaehlen
  287. NummerGad
  288.     move.l  AnGad(a5),a4    
  289.     move.l  (a4),a3
  290.     move.w  gg_GadgetID(a3),d0
  291.     rts
  292. linkeBank
  293.     bsr.s   NummerGad
  294.     sub.w   #18,d0
  295.     tst.w   d0
  296.     bgt.s   linksOk
  297.     moveq   #0,d0
  298. linksOk
  299.     asl.w   #2,d0
  300.     lea     GadgetAddr(a5),a3
  301.     lea     (a3,d0.w),a3                            
  302.     bra.s   GadAnwaehlen
  303. RTastendruck
  304.     cmp.b   #$4e,d5         ;rechts
  305.     beq.b   rechteBank
  306.     cmp.b   #$4f,d5         ;links
  307.     beq.s   linkeBank
  308.     cmp.b   #$4d,d5         ;Down
  309.     beq.w   DownTaste
  310.     cmp.b   #$4c,d5         ;Up
  311.     beq.w   UpTaste
  312.     bra.w   nocheine
  313. VTastendruck
  314.     cmp.b   #$0d,d5
  315.     beq.s   Auswahl
  316.     cmp.b   #$1b,d5
  317.     beq.w   ende
  318.     bclr    #5,d5
  319.     cmp.b   #'Q',d5
  320.     beq.w   ende
  321.     bra.w   nocheine
  322. GetGAddr
  323.     lea     GadgetAddr(a5),a4
  324. FindeGAdd
  325.     cmp.l   (a4)+,a3
  326.     beq.s   RichtGAdd
  327.     bra.s   FindeGAdd
  328. RichtGAdd
  329.     lea     -4(a4),a4
  330.     move.l  a4,AnGad(a5)
  331.     rts
  332. SelGK
  333.     move.l  WindowHandle(a5),a0
  334.     bsr.b   RemoveGSuche
  335.     tst.l   d6
  336.     beq.s   DisSel
  337.     or.w    #GFLG_SELECTED,gg_Flags(a4)
  338.     bra.s   NunSel
  339. DisSel
  340.     eor.w   #GFLG_SELECTED,gg_Flags(a4)
  341. NunSel
  342.     move.l  WindowHandle(a5),a0
  343.     bsr.b   AddGSuche
  344.     rts
  345. RemoveGSuche
  346.     move.l  a4,a1
  347.     move.l  INTUIBase(a5),a6
  348.     jsr     _LVORemoveGadget(a6)
  349.     rts
  350. AddGSuche
  351.     move.l  WindowHandle(a5),a0
  352.     move.l  a4,a1
  353.     moveq   #-1,d0
  354.     jsr     _LVOAddGadget(a6)
  355.     move.l  a4,a0
  356.     move.l  WindowHandle(a5),a1
  357.     suba.l  a2,a2
  358.     jsr     _LVORefreshGadgets(a6)
  359.     rts
  360. Auswahl
  361.     move.l  AnGad(a5),a4
  362.     move.l  (a4),a4
  363. GadAuswertung
  364.     move.w  gg_GadgetID(a4),d6
  365.     asl.b   #1,d6
  366.     subq    #2,d6
  367.     move.l  FileSpeicher(a5),a1
  368. SucheExloop
  369.     cmp.b   #0,(a1)+
  370.     bne.s   SucheExloop
  371.     dbra    d6,SucheExloop
  372.     move.l  a1,d1
  373.     moveq   #0,d2
  374.     moveq   #0,d3
  375.     move.l  DOSBase(a5),a6
  376.     jsr     _LVOExecute(a6)
  377.     moveq   #10,d7
  378.     rts
  379. ;;
  380. ** Refresh Fenster
  381. RefreshWin
  382.     move.l  GADBase(a5),a6
  383.     move.l  WindowHandle(a5),a0
  384.     suba.l  a1,a1
  385.     jsr     _LVOGT_RefreshWindow(a6)
  386.     move.l  WindowHandle(a5),a0
  387.     jsr     _LVOGT_BeginRefresh(a6)
  388.     move.l  WindowHandle(a5),a0
  389.     moveq   #DOSTRUE,d0
  390.     jsr     _LVOGT_EndRefresh(a6)
  391.     rts 
  392. ;;
  393. ** Fenster Öffnen
  394. FensterOeffne
  395.     move.l  INTUIBase(a5),a6
  396.     lea     Fenster_Tags(pc),a1
  397.     move.l  GadgetListe(a5),12(a1)
  398.     lea     WindowTitle(pc),a0
  399.     move.l  a0,4(a1)
  400.     lea     ScreenTitle(pc),a0
  401.     move.l  a0,20(a1)
  402.     move.w  BreiteGPos(a5),d0
  403.     add.w   #40,d0
  404.     move.w  d0,30(a1)
  405.     sub.w   #640,d0
  406.     neg.w   d0
  407.     asr.w   #1,d0
  408.     move.w  d0,54(a1)
  409.     move.w  BreiteWin(a5),d4
  410.     bne.s   BreiteresWin
  411.     move.b  AnzahlGADs(a5),d4
  412. BreiteresWin    
  413.     move.w  d4,d6
  414.     move.w  d6,d5
  415.     add.w   d6,d5
  416.     asl.w   #3,d4
  417.     add.w   d5,d4
  418.     add.w   #36,d4
  419.     move.w  d4,38(a1)
  420.     move.w  #252,d0
  421.     sub.w   d4,d0
  422.     asr.w   #1,d0
  423.     move.w  d0,46(a1)
  424.     suba.l  a0,a0
  425.     jsr     _LVOOpenWindowTagList(a6)
  426.     move.l  d0,WindowHandle(a5)
  427.     beq.b   ErrorWindow
  428.     move.l  4.w,a6
  429.     suba.l  a1,a1
  430.     jsr     _LVOFindTask(a6)
  431.     move.l  d0,meinTask(a5)
  432.     beq.s   ErrorTask
  433.     move.l  d0,a0
  434.     move.l  pr_WindowPtr(a0),alterTask(a5)
  435.     move.l  WindowHandle(a5),pr_WindowPtr(a0)
  436.     rts
  437. ErrorTask
  438.     bsr.s   keinTask
  439. ErrorWindow
  440.     moveq   #26,d7           ;26 = konnte Fenster nicht öffnen oder Task nicht finden
  441.     rts
  442. FensterSchliesse
  443.     move.l  meinTask(a5),a0
  444.     move.l  alterTask(a5),pr_WindowPtr(a0)
  445. keinTask
  446.     move.l  INTUIBase(a5),a6
  447.     move.l  WindowHandle(a5),a0
  448.     jsr     _LVOCloseWindow(a6)
  449.     rts 
  450. ;;
  451. ** Init Gadgets
  452. InitGadget
  453.     move.l  ScreenHandle(a5),a0
  454.     move.l  sc_Font(a0),a1
  455.     move.w  ta_YSize(a1),d2
  456.     add.b   sc_WBorTop(a0),d2
  457.     addq    #1,d2
  458.     move.b  d2,RelativeTopC(a5)
  459.     move.b  sc_WBorTop(a0),RelativeLeftC(a5)
  460.     move.l  FileSpeicher(a5),a1
  461.     move.l  Filegroesse(a5),d0
  462.     move.l  a1,a2
  463.     add.l   d0,a2
  464.     moveq   #0,d0
  465.     moveq   #0,d1
  466.     moveq   #0,d2
  467.     moveq   #0,d3
  468. Suchenloop
  469.     addq    #1,d1             ;länge GadgetName aus der Prefs
  470.     move.b  (a1)+,d4          ;Prefs daten nach d4
  471. einReturn
  472.     cmp.b   #10,d4            ;schon ein Return ?
  473.     bne.s   keinReturn
  474.     move.b  #0,-1(a1)         ;das Return mit NullByte abschliessen
  475.     tst.b   d3                ;d3 0/1 entweder Gadgetname oder Programm bzw. Batchdatei
  476.     beq.s   BreiteZaehlen
  477.     moveq   #0,d3
  478.     bra.s   wortkleiner
  479. BreiteZaehlen
  480.     moveq   #1,d3   
  481.     addq    #1,d0             ;d0=Anzahl der Gadgets
  482.     cmp.b   d2,d1             ;d2 enthält den längsten Gadgetnamen
  483.     bls.s   wortkleiner
  484.     move.b  d1,d2             ;neue länge war größer als alte
  485. wortkleiner
  486.     moveq   #0,d1
  487. keinReturn
  488.     cmp.l   a1,a2             ;a2=a1 dann PrefsEnde
  489.     bne.s   Suchenloop
  490. PrefsEnde
  491.     tst.b   d0
  492.     beq.w   PrefsNull
  493.     move.b  d0,AnzahlGADs(a5)
  494.     asl.w   #3,d2
  495.     add.w   #10,d2
  496.     move.w  d2,BreiteGADs(a5)
  497.     lea     GadgetListe(a5),a0
  498.     move.l  GADBase(a5),a6
  499.     jsr     _LVOCreateContext(a6)
  500.     move.l  d0,a0
  501.     beq.w   ErrorGadget
  502.     lea     UniGad(pc),a1
  503.     move.b  RelativeTopC(a5),d2
  504.     move.b  RelativeLeftC(a5),d3
  505.     add.b   d2,gng_TopEdge+1(a1)
  506.     add.b   d3,gng_LeftEdge+1(a1)
  507.     move.w  BreiteGADs(a5),gng_Width(a1)
  508.     move.l  VisualInfo(a5),gng_VisualInfo(a1)
  509.     move.l  FontAddr(a5),gng_TextAttr(a1)
  510.     move.l  FileSpeicher(a5),a4
  511.     moveq   #0,d6
  512.     move.b  AnzahlGADs(a5),d6
  513.     subq    #1,d6
  514.     lea     GadgetAddr(a5),a3
  515.     move.w  #20,BreiteGPos(a5)
  516. InitGadloop
  517.     moveq   #BUTTON_KIND,d0
  518.     lea     UniGad(pc),a1
  519.     move.l  a4,gng_GadgetText(a1)
  520.     bsr.w   Return2Find
  521.     cmp.w   #180,gng_TopEdge(a1)
  522.     bge.s   GadgetCorritur
  523. GadgetCoOK      
  524.     add.w   #10,gng_TopEdge(a1)
  525.     add.w   #1,gng_GadgetID(a1)
  526.     suba.l  a2,a2
  527.     jsr     _LVOCreateGadgetA(a6)
  528.     move.l  d0,(a3)+
  529.     beq.s   ErrorGadget
  530.     move.l  d0,a0
  531.     dbra    d6,InitGadloop
  532.     cmp.w   #20,BreiteGPos(a5)
  533.     bne.s   BreiteDa
  534.     move.w  BreiteGADs(a5),BreiteGPos(a5)
  535.     rts
  536. BreiteDa    
  537.     move.w  BreiteGADs(a5),d2
  538.     sub.w   #20,d2
  539.     add.w   d2,BreiteGPos(a5)
  540.     rts
  541. GadgetVorEnde   
  542.     sub.w   #40,d2
  543.     move.w  d2,BreiteGPos(a5)
  544.     rts
  545. GadgetCorritur
  546.     clr.w   gng_TopEdge(a1)
  547.     move.b  RelativeTopC(a5),d2
  548.     add.b   d2,gng_TopEdge+1(a1)
  549.     move.w  BreiteGADs(a5),d2
  550.     add.w   #20,d2
  551.     add.w   BreiteGPos(a5),d2
  552.     move.w  d2,d5
  553.     add.w   BreiteGADs(a5),d5
  554.     cmp.w   #630,d5
  555.     bgt.s   GadgetVorEnde
  556.     move.w  d2,BreiteGPos(a5)
  557.     move.w  BreiteGPos(a5),gng_LeftEdge(a1)
  558.     move.w  #17,BreiteWin(a5)      
  559.     bra.s   GadgetCoOK                      
  560. ErrorGadget
  561.     bsr.s   RemoveGadget
  562.     moveq   #25,d7           ;25 = Gadget init Fehler
  563.     rts
  564. RemoveGadget
  565.     move.l  GADBase(a5),a6
  566.     move.l  GadgetListe(a5),a0
  567.     jsr     _LVOFreeGadgets(a6)
  568.     rts 
  569. Return2Find
  570.     cmp.b   #0,(a4)+
  571.     bne.s   Return2Find
  572. Return1Mal
  573.     cmp.b   #0,(a4)+
  574.     bne.s   Return1Mal
  575.     rts
  576. PrefsNull
  577.     moveq   #27,d7           ;27 = Prefs sind Null
  578.     rts
  579. ;;
  580. ** Speicher freigeben von den Einstellungen
  581. SpeicherPrefs
  582.     move.l  FileSpeicher(a5),a1
  583.     move.l  Filegroesse(a5),d0
  584.     move.l  4.w,a6
  585.     jsr     _LVOFreeMem(a6)
  586.     rts
  587. ;;
  588. ** Lade Einstellungen
  589. LadePrefs
  590.     lea     PrefsFile1(pc),a3
  591.     move.l  a3,d1
  592.     move.l  #MODE_OLDFILE,d2
  593.     move.l  DOSBase(a5),a6
  594.     jsr     _LVOOpen(a6)
  595.     move.l  d0,PrefsFileHandle(a5)
  596.     bne.s   OpenPrefsFile
  597.     lea     PrefsFileName(pc),a3
  598.     move.l  a3,d1
  599.     move.l  #MODE_OLDFILE,d2
  600.     jsr     _LVOOpen(a6)
  601.     move.l  d0,PrefsFileHandle(a5)
  602.     beq.s   OpenFileError
  603. OpenPrefsFile
  604.     move.l  d0,d1
  605.     lea     FIB(a5),a3
  606.     move.l  a3,d2
  607.     jsr     _LVOExamineFH(a6)
  608.     move.l  fib_Size(a3),Filegroesse(a5)
  609.     move.l  Filegroesse(a5),d0
  610.     cmp.l   #1,d0
  611.     beq.s   nixPrefs
  612.     tst.l   d0
  613.     beq.s   nixPrefs
  614.     move.l  #MEMF_PUBLIC!MEMF_CLEAR,d1
  615.     move.l  4.w,a6
  616.     jsr     _LVOAllocMem(a6)
  617.     move.l  d0,FileSpeicher(a5)
  618.     beq.s   ErrorFiSp
  619.     move.l  PrefsFileHandle(a5),d1
  620.     move.l  d0,d2
  621.     move.l  Filegroesse(a5),d3
  622.     move.l  DOSBase(a5),a6
  623.     jsr     _LVORead(a6)
  624. SchliesseFile
  625.     move.l  PrefsFileHandle(a5),d1
  626.     jsr     _LVOClose(a6)
  627.     rts
  628. ErrorFiSp
  629.     moveq   #28,d7           ;28 = kein Speicher für Prefs
  630.     bra.s   SchliesseFile
  631. OpenFileError
  632.     moveq   #24,d7           ;24 = konnte File BangerMenu.prefs nicht öffnen
  633.     rts
  634. nixPrefs
  635.     moveq   #27,d7           ;27 = Prefs vorhanden aber leer
  636.     bra.s   SchliesseFile
  637. ;;
  638. ** Library Öffnen + Schliessen
  639. LibOeffne
  640.     move.l  a5,a4
  641.     lea     intname(pc),a1
  642.     bsr.s   OeffneLib
  643.     lea     dosname(pc),a1
  644.     bsr.s   OeffneLib
  645.     lea     gadname(pc),a1
  646.     bsr.s   OeffneLib
  647.     rts
  648. OeffneLib
  649.     moveq   #37,d0
  650.     jsr     _LVOOpenLibrary(a6)
  651.     move.l  d0,(a4)+
  652.     beq.s   LibError
  653.     rts
  654. LibError
  655.     moveq   #22,d7                   ;22 = konnte Library nicht öffnen
  656.     rts
  657. LibSchliesse
  658.     move.l  4.w,a6
  659.     moveq   #3-1,d2
  660.     lea     WindowHandle(a5),a4
  661. SchliesseLib
  662.     move.l  -(a4),a1
  663.     cmp.l   #0,a1
  664.     beq.s   notOpened
  665.     jsr     _LVOCloseLibrary(a6)
  666. notOpened
  667.     dbra    d2,SchliesseLib
  668.     rts
  669. ;;
  670. ** PubScreenOeffne
  671. PubScreenOeffne
  672.     move.l  INTUIBase(a5),a6
  673.     suba.l  a0,a0
  674.     jsr     _LVOLockPubScreen(a6)
  675.     move.l  d0,ScreenHandle(a5)
  676.     move.l  d0,a0
  677.     suba.l  a1,a1
  678.     move.l  GADBase(a5),a6
  679.     jsr     _LVOGetVisualInfoA(a6)
  680.     move.l  d0,VisualInfo(a5)
  681.     beq.s   VisualError
  682.     rts
  683. VisualError
  684.     moveq   #23,d7                  ;23 = GetVisualInfo Fehler
  685.     bra.s   ScrSchliesse
  686. ScreenSchliesse
  687.     move.l  GADBase(a5),a6
  688.     move.l  VisualInfo(a5),a0
  689.     jsr     _LVOFreeVisualInfo(a6)
  690. ScrSchliesse
  691.     move.l  INTUIBase(a5),a6
  692.     suba.l  a0,a0
  693.     move.l  ScreenHandle(a5),a1
  694.     jsr     _LVOUnlockPubScreen(a6)
  695.     rts
  696. ;;
  697. ** LONG Daten
  698. Fenster_Tags    dc.l    WA_Title,0
  699.         dc.l    WA_Gadgets,0
  700.         dc.l    WA_ScreenTitle,0
  701.         dc.l    WA_Width,0
  702.         dc.l    WA_Height,0
  703.         dc.l    WA_Top,11
  704.         dc.l    WA_Left,0
  705.         dc.l    WA_IDCMP,IDCMP1!IDCMP2
  706.         dc.l    WA_Flags,W_Flags1!W_Flags2
  707.         dc.l    WA_NewLookMenus,-1
  708.         dc.l    WA_AutoAdjust,-1
  709.         dc.l    TAG_DONE
  710. W_Flags1        equ     WFLG_ACTIVATE!WFLG_SMART_REFRESH
  711. W_Flags2        equ     WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET
  712. IDCMP1          equ     BUTTONIDCMP!RAWKEY
  713. IDCMP2          equ     IDCMP_CLOSEWINDOW!IDCMP_VANILLAKEY!IDCMP_REFRESHWINDOW
  714. UniGad
  715.         dc.w    20,0,0,10
  716.         dc.l    0,0
  717.         dc.w    0
  718.         dc.l    PLACETEXT_IN,0,0 
  719. topaz8:
  720.         dc.l    0
  721.         dc.w    8
  722.         dc.b    0,1
  723. ;;
  724. ** BYTE Daten
  725. ParaTemplate    dc.b 'NOKEY/S',0
  726. intname         INTNAME
  727. dosname         DOSNAME
  728. gadname         GADTOOLSNAME
  729. inputname       dc.b    'input.device',0
  730. PrefsFileName   dc.b    'S:'
  731. PrefsFile1      dc.b    'BangerMenuDisk.prefs',0
  732. topazFName8     dc.b    'topaz.font',0
  733. WindowTitle     dc.b    'BangerMenuDisk',0
  734.                 dc.b    '$VER: '
  735. ScreenTitle     dc.b    'BangerMenuDisk 1.4 (13-Feb-1996) © by Andre´ Trettin',0
  736. ;;
  737.